//
//  OneselfViewController.m
//  逗她盒子
//
//  Created by Qiaofeng on 15/6/10.
//  Copyright (c) 2015年 Qiaofeng. All rights reserved.
//

#import "OneselfViewController.h"
#import "AFNetworking.h"
#import "OneselfvUITableViewCell.h"
@interface OneselfViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, retain)UITableView *table;
@end

@implementation OneselfViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self =  [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
     
    }
    return self;
}


- (void)createleftBarButton
{
    UIBarButtonItem *dota = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"iconfont-dota.png"] style:UIBarButtonItemStylePlain target:self action:@selector(leftBarButton:)];
    self.navigationItem.leftBarButtonItem = dota;

}
- (void)leftBarButton:(id)sender
{
    
}
// --------------------- json 解析--------------------------------//
- (void)json
{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    NSString *url = [NSString stringWithFormat:@"http://api.maxjia.com/api/search/?"];
    [manager.requestSerializer setValue:@"http://api.maxjia.com/" forHTTPHeaderField:@"Referer"];
    NSDictionary *parameters = @{@"q":@"", @"phone_num":@"00000000000", @"pkey":@"randpkey", @"os_type":@"iOS",@"os_version":@"8.3",@"time":@"1433927795", @"version":@"1.0.0"};
    [manager GET:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary *BigDic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
      
    }];
}





- (void)createTable
{
    self.table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    self.table.delegate = self;
    self.table.dataSource = self;
    [self.view addSubview:self.table];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentfy = @"cell";
    OneselfvUITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentfy];
    if (!cell) {
        cell = [[OneselfvUITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentfy];
    }
    return cell;
}





- (void)loadView
{
    [super loadView];
}
- (void)viewDidLoad {

    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;  // 设置状态栏为白字
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; //设置bar上图片的颜色
    self.title = @"我的数据";
    [self createTable];
    [self createleftBarButton];
    [super viewDidLoad];
    [self json];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
